package implementor;



import model.IssueSlipItem;
import dao.IssueSlipItemDao;
import dbhandelling.Crude;



public class IssueSlipItemImplementor extends Crude implements IssueSlipItemDao
{
	String className=new IssueSlipItem().getClass().getName();
	
	@Override
	public void add(IssueSlipItem issueSlipItems) throws Exception 
	{
		insert(issueSlipItems);
	}

	@Override
	public void update(IssueSlipItem issueSlipItems) throws Exception 
	{
		super.update(className, "mCode", issueSlipItems.getmCode(), "autoIssueSlipItemNo", issueSlipItems.getAutoIssueSlipItemNo()+"");

		super.update(className, "requiredQuant", issueSlipItems.getRequiredQuant()+"", "autoIssueSlipItemNo", issueSlipItems.getAutoIssueSlipItemNo()+"");

		super.update(className, "issueQuant", issueSlipItems.getIssueQuant()+"", "autoIssueSlipItemNo", issueSlipItems.getAutoIssueSlipItemNo()+"");

		super.update(className, "specCode", issueSlipItems.getSpecCode()+"", "autoIssueSlipItemNo", issueSlipItems.getAutoIssueSlipItemNo()+"");

		super.update(className, "slipNo", issueSlipItems.getSlipNo()+"", "autoIssueSlipItemNo", issueSlipItems.getAutoIssueSlipItemNo()+"");
	}

	@Override
	public void delete(IssueSlipItem issueSlipItems) throws Exception 
	{
		delete(className,"autoIssueSlipItemNo", issueSlipItems.getAutoIssueSlipItemNo()+"");
	}

	@Override
	public IssueSlipItem retreive(String conditionField, String ConditionValue) throws Exception 
	{
		IssueSlipItem issueSlipItems=(IssueSlipItem) super.retreive(className,conditionField, ConditionValue);
		return issueSlipItems;
	}

	@Override
	public IssueSlipItem[] retreiveArray(String conditionField, String conditionValue) throws Exception 
	{
		IssueSlipItem[] issueSlipItemss;
		Object[] obj=super.retreiveArrayOnCondition(className, conditionField, conditionValue);
		issueSlipItemss=new IssueSlipItem[obj.length];
		
		for(int i=0;i<issueSlipItemss.length;i++)
		{
			issueSlipItemss[i]=(IssueSlipItem) obj[i];
		}
		
		return issueSlipItemss;
	}

	@Override
	public IssueSlipItem[] retreiveAll() throws Exception 
	{
		IssueSlipItem[] issueSlipItemss;
		
		Object[] obj=super.retreiveAll(className);
		
		issueSlipItemss=new IssueSlipItem[obj.length];
		
		for(int i=0;i<issueSlipItemss.length;i++)
		{
			issueSlipItemss[i]=(IssueSlipItem) obj[i];
		}
		
		return issueSlipItemss;
	}

}
